/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Bean;

import Action.TicketsSessionBeanLocal;
import Entity.Customer;
import Entity.Tickets;
import Entity.TicketsCategory;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;

import javax.faces.bean.SessionScoped;

/**
 *
 * @author Cyrax
 */
@ManagedBean
@SessionScoped
public class TicketsBean {

    @EJB
    private TicketsSessionBeanLocal ticketsSessionBean;
    private Tickets tk;
    private List<Tickets> tic;
    private Customer cu;
    private TicketsCategory tkCat;

    /** Creates a new instance of TicketsBean */
    public TicketsBean() {
        tk = new Tickets();

    }

    /**
     * @return the tk
     */
    public Tickets getTk() {
        return tk;
    }

    /**
     * @param tk the tk to set
     */
    public void setTk(Tickets tk) {
        this.tk = tk;
    }

   

    /**
     * @return the cu
     */
    public Customer getCu() {
        return cu;
    }

    /**
     * @param cu the cu to set
     */
    public void setCu(Customer cu) {
        this.cu = cu;
    }

    /**
     * @return the tkCat
     */
    public TicketsCategory getTkCat() {
        return tkCat;
    }

    /**
     * @param tkCat the tkCat to set
     */
    public void setTkCat(TicketsCategory tkCat) {
        this.tkCat = tkCat;
    }
    //List all
     public List<Tickets> getListAllTickets() {
        tic = ticketsSessionBean.listAllTickets();
        return tic;
    }
   //Update status
     public void updateStatus()
     {
        int tsId = tk.getTicketsId();

        System.out.println("Xem Id:" + tsId);

        ticketsSessionBean.updateTickets(tsId,tk.getStatus());

     }
      public void deleteTickets(Tickets tk)
     {

        ticketsSessionBean.DeleteTickets(tk);

     }
}
